<{include file="header.html"}>

<script type="text/javascript">
	function validate()
	{
        var email = document.getElementById('EMAIL');
        if(isEmptyTextBox(email, '<{$smarty.const._LB_EMAIL_IS_EMPTY|utf8_escape_js}>'))
			return false;
        if(!isValidLengthTextBox(email, <{$smarty.const.MAX_LENGTH_NAME}>, '<{$smarty.const._MSG_EMAIL_IS_TOO_LONG|utf8_escape_js}>')){
            return false;
        }
        
        if(!isValidEmail(email,'<{$smarty.const._LB_INVALID_EMAIL|utf8_escape_js}>')){
            return false;
        }

        // check whether or not email exist
		var agr = new Array();
		agr.push(email.value);

		if(callFunction("Newsletter::isExist", agr) == '1')
		{
			showErrorBubble(email, "<{$smarty.const._MSG_EXIST_EMAIL|utf8_escape_html}>" );
			return false;
		}
		document.newsletter_form.submit();
	}
</script>

	<div class="one_third">
            <div class="box_tool">
				<div class="box_head"><{$smarty.const._LB_TOOLBOX|utf8_escape_html}></div>
				<div class="box_content">
					<a href="<{$smarty.const.APPLICATION_URL}>/newsletter/export/">
						<{$smarty.const._LB_NEWSLETTER_EXPORT|utf8_escape_html}>
					</a>
				</div>
			</div>
			<div class="spacer"></div>
			<div class="box_tool">
				<div class="box_head"><{$smarty.const._LB_ADD_NEWSLETTER|utf8_escape_html}></div>
				<div class="box_content">
					<form id='newsletter_form' name='newsletter_form' method="post" action="">
						<input type="hidden" id="act" name="act" value="1"/>
					<div class="content" style="padding-bottom:0px;">
						<table class="">
							<tr>
								<td width="20%"><{$smarty.const._LB_EMAIL|utf8_escape_html}>&nbsp;:&nbsp;<{$smarty.const._LB_REQUIRE_FIELD}></td>
								<td><input style="width:98%;" name="EMAIL" id="EMAIL" type="text" size="<{$smarty.const.SIZE_NAME}>" value="<{$letter->EMAIL|utf8_escape_html}>" /></td>
							</tr>
						</table>
					</div>
					<div class="submit" align="right" style="padding-top:10px;">
						<a class="tribullet" href="#" onclick="validate()"><{$smarty.const._LB_VALIDATE}></a>
					</div>
					</form>
				</div>
			</div>
			<div class="spacer"></div>
	</div>

	<div class="two_third">
		<div class="box_two_third">
		<div class="box_head"><{$smarty.const._LB_NEWSLETTER_MANAGEMENT|utf8_escape_html}></div>
		<div class="box_content">
			<div>
				<{if $newsletter->N > 0 }>
					<{while $newsletter->fetch()}>
						<div class="object">
							<div class="head">
								<span class="right">
									<a onclick="return confirm('<{$smarty.const._MSG_NEWSLETTER_DELETE_CONFIRM|utf8_escape_html}>')" href="<{$smarty.const.APPLICATION_URL}>/newsletter/delete?EMAIL=<{$newsletter->EMAIL}>"><img src="<{$smarty.const.APPLICATION_URL}>/images/<{$smarty.const.IMAGE_NAME_DELETE}>" alt="" class="small" title="<{$smarty.const._LB_DELETE|utf8_escape_html}>" /></a>
								</span>
								<img src="<{$output->buildImagePath($smarty.const.IMAGE_NAME_USER_SMALL)}>" alt="" class="small" />
								<{$newsletter->EMAIL|utf8_escape_html}>
							</div>

						</div>
					<{/while}>
				<{else}>
					<{$smarty.const._LB_NO_ITEM|utf8_escape_html}>
				<{/if}>
			</div>
		</div>
	</div>
	</div>

<{include file="footer.html"}>